/*
 * GameWindow.h
 *
 *  Created on: May 11, 2012
 *      Author: mklingen
 */

#ifndef GAMEWINDOW_H_
#define GAMEWINDOW_H_
#include "../QSFMLCanvas.h"
#include "../ResourceManagement/ResourceManager.h"
#include "../ResourceManagement/ImageResource.h"
#include "../MathUtils.h"
#include "GameComponentManager.h"
#include "SpriteComponent.h"
#include "Camera.h"
#include <QKeyEvent>


namespace kling
{

    class GameComponentManager;
    /// Custom SFML canvas for displaying SFML
    class GameWindow: public QSFMLCanvas
    {
        public:
            /// Construct the canvas
            GameWindow(QWidget* Parent, const QPoint& Position, const QSize& Size);
            virtual ~GameWindow();

            inline ResourceManager* GetResourceManager() { return m_resourceManager; }
            inline GameComponentManager* GetComponentManger() { return m_componentManager; }

        private:
            kling::ResourceManager* m_resourceManager;
            kling::GameComponentManager* m_componentManager;
            kling::SpriteComponent* m_testSprite;
            kling::Camera* m_camera;

            /// /see QSFMLCanvas::OnInit
            void OnInit();

            /// /see QSFMLCanvas::OnUpdate
            void OnUpdate();

            void keyPressEvent(QKeyEvent* keyEvent);
            void keyReleaseEvent(QKeyEvent* keyEvent);
            void Update(double dt);
            void Render(double dt);
    };

} /* namespace kling */

#endif /* GAMEWINDOW_H_ */
